<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<c:set var="plugin" value="${pageContext.request.contextPath}/static/fw/plugin" />
<c:set var="plugin_relative" value="/static/fw/plugin" />

<script type="text/javascript">
var ctx = "${ctx}"
 ,plugin = "${plugin}"
 ,plugin_relative = "${plugin_relative}"
 ,sessionId= "${pageContext.session.id}"
 ;
</script>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>模拟数据</title>
<script type="text/javascript" src="${ctx}/static/js/jquery/2.1.1/jquery-2.1.1.min.js"></script>
<script type="text/javascript">
 $(function(){
	 $("#start").on("click",function(){
		 var data = {};
		 data.schema = $("#schema").val();
		 data.table = $("#table").val();
		 data.count = $("#count").val();
		 if(confirm("确定开始导入模拟数据？")){
			 $.post(ctx+"/start",data,function(result){
				 if(result.status==200){
					 alert("已开始导入模拟数据!")
				 }else{
					 alert("出错啦!"+result.msg);
				 }
			 });
		 }
	 });
	 $("#stop").on("click",function(){
		 if(confirm("确定停止导入模拟数据？")){
			 $.post(ctx+"/stop",null,function(result){
				 if(result.status==200){
					 alert("已停止导入模拟数据!")
				 }else{
					 alert("出错啦!"+result.msg);
				 }
			 });
		 }
	 });
 })
</script>

</head>
<body>
  <center>
     <div style="margin: 20px">
       	库名:<input id="schema" name="schema" value="base_db">
       	 表名:<input id="table" name="table" value="teacher">  
       	 数量:<input id="count" name="count" value="10000">
     </div>
     <div>
     <div>导入数据线程是否已停止：${status}</div>
     <button id="start">开始导入</button> <button id="stop">停止导入</button>
     </div>
  </center>
</body>
</html>